import {
    constructProxy
} from "./proxy.js";
import {
    mount
} from './mount.js'

let uid = 0;

export function initMixin(FVue) {
    FVue.prototype._init = function (options) {
        const vm = this;

        // 基础属性
        vm.uid = uid++;
        vm._isFvue = true;

        // 初始化data
        if (options && options.data) {
            this._data = constructProxy(vm, options.data, '')
        }
        // 初始化el 挂载
        if (options && options.el) {
            let rootDom = document.getElementById(options.el);
            mount(vm, rootDom)
        }
    }
}